package com.zheng.springcloud;

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import com.netflix.loadbalancer.ZoneAvoidanceRule;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.context.annotation.Bean;


/**
 * @author lenovo
 */
@SpringBootApplication
@EnableEurekaClient
@RibbonClient(name = "provider-dept",configuration = ZoneAvoidanceRule.class)
@EnableHystrix
@EnableHystrixDashboard
public class SpringCloud_Dept_Hystrix_Dashborad {
    public static void main(String[] args) {
        SpringApplication.run(SpringCloud_Dept_Hystrix_Dashborad.class,args);
    }

    @Bean
    public ServletRegistrationBean a(){
        ServletRegistrationBean registration = new ServletRegistrationBean(new HystrixMetricsStreamServlet());
        registration.addUrlMappings("/actuator/hystrix.stream");
        return registration;
    }
}
